<%@ Page EnableEventValidation="false" EnableViewState="false" Language="vb" AutoEventWireup="false" CodeFile="emailTemplate.aspx.vb" Inherits="pages_EmailTemplates_EmailTemplate"
    MasterPageFile="~/pages/default.master"
    Title="Add or Change a EmailTemplate."
    ValidateRequest="False"
    
%>
<asp:Content ID=h runat=server ContentPlaceHolderID=head>
    <style>
        textarea { font-family:Courier New; font-size:10px; }
    </style>
    <script>

        $("textarea").keydown(function (e) {
            if (e.keyCode === 9) { // tab was pressed
                // get caret position/selection
                var start = this.selectionStart;
                end = this.selectionEnd;

                var $this = $(this);

                // set textarea value to: text before caret + tab + text after caret
                $this.val($this.val().substring(0, start)
                        + "\t"
                        + $this.val().substring(end));

                // put caret at right position again
                this.selectionStart = this.selectionEnd = start + 1;

                // prevent the focus lose
                return false;
            }
        });
    </script>
</asp:Content>

<asp:Content ID=t runat=server ContentPlaceHolderID=above>
    <div style="margin-top:15px; margin-bottom:15px;"><asp:DropDownList ID=ddTemplate runat=server DataTextField=TemplateName DataValueField=TemplateId AutoPostBack=true /></div>
</asp:Content>


<asp:Content ID="c" ContentPlaceHolderID="body" runat="server">

    <uc:FormBegin ID="fb" runat="server" />
        <uc:Textbox  ID="txtTemplateName" runat="server" Required="false" Label="Name" />
        <uc:Textbox  ID="txtTemplateSubject" runat="server" Required="false" Label="Subject" />
        <uc:Textarea  ID="txtTemplateBody" runat="server" Required="false" Label="Body" Width=600 Height=250 />
        <uc:FormButtonsBegin ID="fbb" runat="server" />
            <asp:button id="btnSave"    runat="server" text="Update" causesvalidation="True"  />
            <asp:button id="btnDelete"  runat="server" text="Delete" causesvalidation="False" OnClientClick="return confirm('Delete this EmailTemplate?')" />
            <asp:button id="btnCancel"  runat="server" text="Cancel" causesvalidation="False" />
        <uc:FormButtonsEnd   ID="fbe" runat="server" />
        <uc:Checkbox ID="chkTemplateHasSubject" runat="server" Required="false" Label="Main" Text="Includes a subject" />
        <uc:Checkbox ID="chkTemplateIsHtml" runat="server" Required="false" Label="Html" Text="Html-Formatted (components should match)" />
        <uc:Textbox  ID="txtTemplateTags" runat="server" Required="false" Label="Tags" Width=600 />
    <uc:FormEnd ID="fe" runat="server" />
    
    <asp:ValidationSummary ID="vs" runat="server" ShowSummary="true" EnableClientScript="true" DisplayMode="BulletList" />
</asp:Content>
